Prizm Content Connect
E-Signing Samples

Overview

The C# and PHP web tiers have been updated to support the needs of the form template designer and e-signer web apps. To accomplish this, two new classes were created in both web tiers:

  1. CreateSession: Takes web client requests for a viewing session and submits them to a PCC server. Sends back the PCC server response which, when successful, includes a viewing session ID. In the PHP web tier, this class is located in the file named "CreateSession.php" and in the C# web tier it’s named "PccViewer.WebTier.Core.CreateSession.cs". 
  2. FormDefinitions: Provides a REST API for creating, reading, updating, and deleting persisted form definitions. Form definitions are JSON objects that are saved from the form template designer and can later be loaded in to either the designer or the e-signer. In the PHP web tier, this class is located in the file named "FormDefinitions.php" and in the C# web tier it’s named "PccViewer.WebTier.Core.HttpFormDefinitions.cs".

CreateSession Class API

The following public methods are available, to be used by other application code directly.

public string fromDocumentName (String documentName)

Creates a session based on a document name. This method uses the "DocumentPath" setting in the pcc.config file to look up a document by the specified name in that folder.

Returns the viewing session id as a string.

public string fromFormDefinition (String formDefinitionId)

Creates a session based on a form definition. This method uses the "FormDefinitionPath" parameter in the pcc.config file to look up a form definition stored using the specified ID in that folder. Then, it will read the form definition file which contains a JSON object with a "templateDocument" property. That property’s value is a document name that can be looked up in the folder specified by "DocumentPath" in the same pcc.config file.

Returns the viewing session id as a string.

public string fromStream (Stream fileStream, String fileExtension)

Creates a session based on an existing Stream object (such as a file stream) and a file extension defined as a string.

Returns the viewing session id as a string.

Url Mappings:

The following URL mappings are exposed, to be used as an HTTP API.

/CreateSession?document=name.ext

Uses "fromDocumentName" in order to create a viewing session.

Responses:

200

Example
Copy Code
{
  "viewingSessionId": {viewingSessionId}
}

/CreateSession?form=formDefinitionId

Uses "fromFormDefinition" in order to create a viewing session.

Responses:

200

Example
Copy Code
{
  "viewingSessionId": {viewingSessionId}
}

REST Service Endpoints Implemented in FormDefinitions Class

GET /FormDefinitions

Returns a list of all definitions on the server.

Responses:

200 OK

Example
Copy Code
[
   {
       "name" {string}: the name of the form definition (as assigned by the user)
       "formDefinitionId" {string}: a unique ID for that particular resource
   },
   {
       "name": "Time Off Request",
       "formDefinitionId": "guid"
   },
   {...}
]

580 Server Error

Example
Copy Code
{
   "errorCode" {string}: "ServerError",
   "errorMessage" {string}: a useful message about what happened, such as a file read error
   "formDefinitionId": {formDefinitionId} If a form definition file could not be parsed, it’s ID will be displayed here.
}

GET /FormDefinitions/{formDefinitionId}

Returns a specific form definition.

Responses:

200 OK

Example
Copy Code
JSON data for FormDefinition

404 Not Found

Example
Copy Code
None

580 Server Error

Example
Copy Code
{
   "errorCode": "ServerError",
   "errorMessage" {string}: "A useful error message about the server error."
   "formDefinitionId": {formDefinitionId}
}

POST /FormDefinitions

Creates a new form definition, as defined in the request body.

Body:

Example
Copy Code
JSON data for FormDefinition

Responses:

201 Created

Example
Copy Code
{
   "formDefinitionId": "guid"
}

580 Server Error

Example
Copy Code
{
   "errorCode" {string}: "ServerError",
   "errorMessage" {string}: exception message,
   "formDefinitionId": {formDefinitionId}
}

POST /FormDefinitions/{formDefinitionId}

Updates an existing form definition.

Body:

Example
Copy Code
JSON data for FormDefinition

Responses:

200 OK

Example
Copy Code
None

404 Not Found

Example
Copy Code
None

580 Server Error

Example
Copy Code
{
   "errorCode" {string}: "ServerError",
   "errorMessage" {string}: exception message,
   "formDefinitionId": {formDefinitionId}
}

POST /FormDefinitions/{formDefinitionId}

Request Headers:

Example
Copy Code
X-HTTP-Method-Override: DELETE

Deletes a form definition from storage. Note: the implementation allows for this to be an actual DELETE verb, if supported.

Body:

Example
Copy Code
None

Responses:

204 No Content

Example
Copy Code
None

404 Not Found

Example
Copy Code
None

580 Server Error

Example
Copy Code
{
   "errorCode" {string}: "ServerError",
   "errorMessage" {string}: exception message,
   "formDefinitionId": {formDefinitionId}
}

Form Definition Schema

Example
Copy Code
{
       "templateDocumentId" {string}: "I-9 Form.pdf",
       "globalSettings" {object}: {
              "signatureDateFormat" {string}: "MM/DD/YYYY"
       },
       "formDefinitionId" {string}: "04a6032f3eaa4a8a9eb1b5fce1cb99e9",
       "formName" {string}: "Form I-9",
       "formData" {array}: [
       {
             "fieldId" {string}: "Text1",
             "template" {string}: "TextTemplate",
             "rectangle" {object}: {
                "width" {number}: 162.21070234113716,
                "height" {number}: 14.839464882943162,
                "x" {number}: 39.91304347826082,
                "y" {number}: 179.0969899665552
             },
             "pageNumber" {number}: 1,
             "sortIndex" {number}: 1,
             "fontName" {string}: "Fira Sans",
             "fontColor" {string}: "#000000",
             "displayName" {string}: "Last Name",
             "required" {boolean}: true,
             "characterLimit" {number}: 0,
             "pageData" {object}: {
                "width" {string}: 612,
                "height" {string}: 792
             }
       }
       ]
}

 

 

 


©2015. Accusoft Corporation. All Rights Reserved.

Send Feedback